package mini.statement;


import java.util.HashMap;
import java.util.LinkedList;

import mini.Proc;
import mini.StatementList;
import mini.expr.Expr;

public class RepeatStatement extends Statement {

    private Expr expr;
    private StatementList sl;

    public RepeatStatement(StatementList list, Expr e) {
        expr = e;
        sl = list;
    }

    public void eval(HashMap<String, Integer> nametable, HashMap<String, Proc> functiontable, LinkedList var) {
        do {
            sl.eval(nametable, functiontable, var);
        } while (expr.eval(nametable, functiontable, var) > 0);

    }
}
